package com.xbts.system.api.factory;

import com.xbts.common.core.domain.R;
import com.xbts.common.core.web.domain.AjaxResult;
import com.xbts.system.api.RemoteFileService;
import com.xbts.system.api.RemoteScreenService;
import com.xbts.system.api.domain.SysFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务降级处理
 *
 * @author xbts
 */
@Component
public class RemoteScreenFallbackFactory implements FallbackFactory<RemoteScreenService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteScreenFallbackFactory.class);

    @Override
    public RemoteScreenService create(Throwable throwable) {
        log.error("大屏服务调用失败:{}", throwable.getMessage());
        return new RemoteScreenService() {
            @Override
            public AjaxResult task() {
                return AjaxResult.error("产能信息读取失败:" + throwable.getMessage());
            }
        };
    }
}
